import Taro from "@tarojs/taro";
const globalData = {};

export function setGlobal(key, val) {
  globalData[key] = val;
}

export function getGlobal(key) {
  return globalData[key];
}

export function isLogin() {
  return !!getGlobal("userInfo");
}

export function checkLogin() {
  if (!isLogin()) {
    Taro.showToast({ title: "您尚未登录", icon: "none" });
    return false;
  }
  return true;
}
